package entity

import "database/sql"

type Base struct {
	ID        uint
	DeletedAt sql.NullTime
}

type BaseEntity interface {
	GetID() uint
	IsDeleted() bool
	Delete()
	Recover()
}

func (b *Base) GetID() uint {
	return b.ID
}

func (b *Base) IsDeleted() bool {
	return b.DeletedAt.Valid
}

func (b *Base) Delete() {
	b.DeletedAt = sql.NullTime{Valid: true}
}

func (b *Base) Recover() {
	b.DeletedAt = sql.NullTime{Valid: false}
}
